#include "types.h"
#include "core.h"
#include <iostream>

using namespace std;

int
main ()
{
  cout << "~~~ REDLisp Test 1 ~~~\n";
  List *l = new List ();
  cout << "l->type (): " << l->type () << "\n";
  Object *s1 = new String ("Stranger in a Strange Land");
  cout << "s1->type (): " << s1->type () << "\n";
  cout << "l->toString (): " << l->toString () << "\n";
  l->insert (s1);
  cout << "l->insert (s1): " << l->toString () << "\n";
  String *s2 = new String ("Time Enough for Love");
  cout << "s2->type (): " << s2->type () << "\n";
  l->insert (s2);
  cout << "l->insert (s2): " << l->toString () << "\n\n*** LIST TEST 1 ***\n";
  l->append (s2);
  cout << "l->append (s2): " << l->toString () << "\n"
       << "l->size (): " << l->size () << "\n"
       << "l->empty (): " << l->empty () << "\n"
       << "(*l)[1]->toString (): " << (*l)[1]->toString () << "\n"
       << "(*l)[2]->toString (): " << (*l)[2]->toString () << "\n"
       << "(*l)[3]->toString (): " << (*l)[3]->toString () << "\n"
       << "\n*** LIST TEST 2 ***\n";
  l->remove (2);
  cout << "l->remove (2): " << l->toString () << "\n"
       << "(*l)[1]->toString (): " << (*l)[1]->toString () << "\n"
       << "(*l)[2]->toString (): " << (*l)[2]->toString () << "\n"
       << "(*l)[3]->toString (): " << (*l)[3]->toString () << "\n"
       << "\n*** EVAL TEST 1 ***\n";
  l->insert (new Symbol ("testing"));
  cout << "l->insert ('testing): " << l->toString () << "\n";
  eval (l, l);
  cout << "\n*** EVAL TEST 2 ***\n";
  l->insert (new Symbol ("quote"));
  cout << "l->insert ('quote): " << l->toString () << "\n";
  eval (l, l);
  cout << "\n*** EVAL TEST 3 ***\n";
  l->insert (new Error ("If you're crazy, I don't care, you amaze me"));
  cout << "l->insert (error): " << l->toString () << "\n";
  l->insert (new Symbol ("testing"));
  indent ("=>");
  cout << eval (l, l)->toString () << "\n\n*** EVAL TEST 4 ***\n";
  l->remove (0);
  l->remove (0);
  l->insert (new Symbol ("testing"));
  l->insert (new Error ("What do you want me to do? To make it happen now?"));
  cout << "l->insert (error): " << l->toString () << "\n";
  cout << eval (l, l)->toString () << endl;
  return 0;
}
